package game.mapviewer.popups.losses 
{
	import com.rnk.tilelist.TileCell;
	import flash.display.MovieClip;
	import game.map.UnitTypes;
	
	/**
	 * ...
	 * @author rnk
	 */
	public class UnitCell extends TileCell
	{
		private var bg:MovieClip;
		
		public function UnitCell() 
		{
			bg = new unitcell_mc();
			addChild(bg);
		}
		
		override public function Init():void 
		{
			super.Init();
			
			var lossesPopup:LossesPopup = papa.data.papa as LossesPopup;
			
			bg.playerNameText.text = lossesPopup.papa.papa.papa.GetPlayer(data.player).name;
			bg.playerNameText.textColor = lossesPopup.papa.papa.papa.GetPlayer(data.player).color;
			
			var unitIcons:Object = { };
			unitIcons[UnitTypes.ARCHER] = archer2;
			unitIcons[UnitTypes.FOOTMAN] = footman;
			unitIcons[UnitTypes.KNIGHT] = knight;
			unitIcons[UnitTypes.LANDSKNEHT] = landsknecht;
			
			var unitIcon:MovieClip = new unitIcons[data.unit]();
			unitIcon.x = bg.unitExample.x;
			unitIcon.y = bg.unitExample.y;
			bg.addChild(unitIcon);
			
			bg.removeChild(bg.unitExample);
		}
		
		override public function Die():void 
		{
			super.Die();
		}
		
	}

}